package java0106;

import java.lang.String;

public class Java03 {
    public static void main(String[] args) {

        // 字符串类java.lang.String
        // 了解：字符串的底层的本质是字符数组char[]
        String s1 = "abcde";// ['a','b','c','d','e']
        System.out.println(s1);

        // 相等
        boolean a = "abc".equals("abcd");
        System.out.println(a);

        // 查找
        int b = "abcde".indexOf("cdx");
        System.out.println(b);

        // 截取
        String c = "abcde".substring(1, 3);
        System.out.println(c);

        // 长度
        int d = "abcde".length();
        System.out.println(d);

        // 去除两边空格
        String e = "  abc     ".trim();
        System.out.println(e);

        // 替换
        String f = "abc123abc123".replace("123", "张三");
        System.out.println(f);

        // 根据下标获取字符
        char g = "abcde".charAt(0);
        System.out.println(g);

    }
}
